import java.util.*;

/* Class to constuct a list of adjectives (from the class Adjektiv)
 * 
 * 
 * 
 * 
 */



public class AdjektivListe
{
  ///////////////////////////// fields ////////////////////////
  
  private ArrayList<Adjektiv> adjektivArrayListWithAdjectives = new ArrayList<Adjektiv>();
  private int numberOfAdjectives;
  
  
  /////////////// consructors ////////////////////////////////////
  
  /** Constructor to contruct an AdjektListe cotaining an ArrayList of adjectives (from class Adjektiv)
   * 
   * 
   * 
   * */
  
  
  public AdjektivListe()
  {
    numberOfAdjectives = GenerateRandomNumber.generateNumber();
    
    for(int i = 0; i < numberOfAdjectives; i++)
    {
      Adjektiv adjektivToBeAddedToAdjektivListe = new Adjektiv();
      
      adjektivArrayListWithAdjectives.add( adjektivToBeAddedToAdjektivListe );
    }
  }
  
      ///////////////////////////// methods ////////////////////////
  
  /** Method to output the Adjektivliste object as a string, where the elements in the ArrayList are seperated by ","
   * and the last element is preceeded by "og"
   * 
   * @return string containing the adjectives seperated by comma.
   * */

  public String toString()
  {
    String returnedString = ""; // creates an empty string that contains nothing, note: it does NOT contain null
    
    for(int i = 0; i < adjektivArrayListWithAdjectives.size(); i++)
    {
      if (i == 0)
      {
        returnedString += adjektivArrayListWithAdjectives.get(i).toString();
      }
      else if(i == adjektivArrayListWithAdjectives.size() - 1)
      {
       returnedString += " og " + adjektivArrayListWithAdjectives.get(i).toString(); 
      }
      else
      {
        returnedString += ", " + adjektivArrayListWithAdjectives.get(i).toString();
      }
    }
    return returnedString;
  }
 
  
  
}

